window.addEventListener('load',function() {
    animate();
});

function animate(obj, target, cellback, intervalTimer) {

    let timer = setInterval(() => {
    // let step = target - obj.offsetLeft;
    if (obj.offsetLeft == target) {
         clearInterval(timer);
         if(cellback){
             cellback();
         }
    }
        obj.style.left = obj.offsetLeft + 5 +'px';
    }, intervalTimer);
     
    };